/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * ConnectorPanel.java
 *
 * Created on 10.08.2013, 13:32:18
 */
package transgui;

/**
 * panels for the individual mapping of pin to constructor, to be used in the ConnectorGUI
 * @author Andreas Gruner
 */
public class ConnectorPanel extends javax.swing.JPanel {

    /** Creates new form ConnectorPanel */
    public ConnectorPanel() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        ConnectorPanel = new javax.swing.JPanel();
        jLabel20 = new javax.swing.JLabel();
        jTextFieldCPEagle = new javax.swing.JTextField();
        jLabel21 = new javax.swing.JLabel();
        jTextFieldCPModelica = new javax.swing.JTextField();

        ConnectorPanel.setLayout(new java.awt.GridLayout(1, 4));

        setLayout(new java.awt.GridLayout());

        jLabel20.setText("EAGLE pin name");
        add(jLabel20);

        jTextFieldCPEagle.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextFieldCPEagleActionPerformed(evt);
            }
        });
        add(jTextFieldCPEagle);

        jLabel21.setText("Modelica connector name");
        add(jLabel21);
        add(jTextFieldCPModelica);
    }// </editor-fold>//GEN-END:initComponents
    
    public String getKey() {
    	return jTextFieldCPEagle.getText();
    }
    public String getValue() {
    	return jTextFieldCPModelica.getText();
    }
    public boolean isValidValue() {
    	if ((!jTextFieldCPEagle.getText().equals("")) && (!jTextFieldCPModelica.getText().equals("")) && 
    			(!jTextFieldCPEagle.getText().contains(" ")) && (!jTextFieldCPModelica.getText().contains(" ")) && 
    			(!jTextFieldCPEagle.getText().contains("|")) && (!jTextFieldCPModelica.getText().contains("|"))) {
    		return true;
    	} else {
    		return false;
    	}
    }

    private void jTextFieldCPEagleActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextFieldCPEagleActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_jTextFieldCPEagleActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel ConnectorPanel;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JTextField jTextFieldCPEagle;
    private javax.swing.JTextField jTextFieldCPModelica;
    // End of variables declaration//GEN-END:variables
}
